using System.Collections.Generic;

public class Table_GlobalDialogItem : IDataItem
{
	/// <summary>
	/// 唯一ID
	/// <summary>
	public int Id { get; private set; }
	/// <summary>
	/// 对话框类型
	/// <summary>
	public int TipType { get; private set; }
	/// <summary>
	/// 对话标题ID
	/// <summary>
	public int Title { get; private set; }
	/// <summary>
	/// 内容ID
	/// <summary>
	public int ContentId { get; private set; }
	/// <summary>
	/// 按钮文本ID
	/// <summary>
	public int GetBtnNameCount() { return BtnName.Count; }
	private List<int> BtnName = new List<int>();
	public int GetBtnNameByIndex(int idx)
	{
		return BtnName.GetValueByIdx(idx, 0);
	}
	/// <summary>
	/// 是否显示关闭
	/// <summary>
	public bool TapClose { get; private set; }

	public Table_GlobalDialogItem(ExcelLineReader reader)
	{
		Id = reader.ReadInt();
		TipType = reader.ReadInt();
		Title = reader.ReadInt();
		ContentId = reader.ReadInt();
		BtnName = reader.ReadShortString().ToIntList();
		TapClose = reader.ReadBool();
	}
}

public class Table_GlobalDialogMgr : IDataMgr
{
	protected override string FileName { get { return "Txt/GlobalDialog.txt"; } }

	protected Dictionary<int, int> mItemDic = new Dictionary<int, int>();
	public int GetIdxById(int key) { return mItemDic[key]; }

	public override void Load(ExcelLineReader reader)
	{
		var item = new Table_GlobalDialogItem(reader);
		mItemDic[item.Id] = DataCount;
		mItemList.Add(item);
	}

	public Table_GlobalDialogItem GetItemByIdx(int idx)
	{
		return GetItemByIdx<Table_GlobalDialogItem>(idx);
	}

	public Table_GlobalDialogItem GetItemById(int id)
	{
		int idx = GetIdxById(id);
		return GetItemByIdx(idx);
	}
}